﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SaleOnlineSystem.Admin.Controls
{
    public partial class AddYahooOnline : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                int nextid = Convert.ToInt32(DAL.DCollector.DBCollector.Instance.getNextID("tbl_HelpOnline", "HelpOnline_ID"));
                if (txtName.Text != "")
                {
                    if (txtEmail.Text != "")
                    {
                        int idnextyahoo = nextid + 1;
                        string value = "" + idnextyahoo + ",N'" + txtName.Text + "','" + txtEmail.Text + "'";
                        List<string> values = new List<string>();
                        values.Add(value);
                        DAL.DCollector.DBCollector.Instance.StoredProcedureInsertByRows("tbl_HelpOnline", "insertemployee", values, false);
                        Response.Redirect("/Admin/Index.aspx?panel=7&sub=2");

                    }
                    else
                    {
                        Response.Write("<script>alert('Vui lòng nhập Yahoo hỗ trợ trực tuyến...')</script>");
                    }
                }
                else
                {
                    Response.Write("<script>alert('Vui lòng nhập tên hỗ trợ trực tuyến...')</script>");
                }
            }
            catch (Exception)
            {
                Response.Redirect("/error.htm");
            }
        }
    }
}